import httpFetch from "share/httpFetch"
import errorMessage from "share/errorMessage";

export default {

  getMeiYaAccountPeriodListGroup(page, size, params) {
    return httpFetch.get(`/api/meiya/acount/period/list/group`, {page, size, ...params})
      .catch(e => {
        errorMessage(e.response);
        throw e;
      });
  },
  confirmByAccountPeriod(accountPeriod) {
    return httpFetch.put(`/api/meiya/acount/period/confirm?accountPeriod=${accountPeriod}`, {})
      .catch(e => {
        errorMessage(e.response);
        throw e;
      });
  },
  deleteMeiYaAccountPeriodBy(accountPeriod) {
    return httpFetch.delete(`/api/meiya/acount/period/delete?accountPeriod=${accountPeriod}`, {})
      .catch(e => {
        errorMessage(e.response);
        throw e;
      });
  },
  getMeiYaAccountPeriodList(page, size, params) {
    return httpFetch.get(`/api/meiya/acount/period/list`, {page, size, ...params})
      .catch(e => {
        errorMessage(e.response);
        throw e;
      });
  },
  exportTemplate() {
    return httpFetch.get(`/api/meiya/acount/period/export/template`, {}, {}, {responseType: 'arraybuffer'})
  }
}
